home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / mail / pine3.96.tar.gz / pine3.96.tar / pine3.96 / imap / non-ANSI / c-client / imap2.h < prev    next >
C/C++ Source or Header  |  1995-09-07  |  7KB  |  220 lines

  1. /*
  2.  * Program:    Interactive Mail Access Protocol 2 (IMAP2) routines
  3.  *
  4.  * Author:    Mark Crispin
  5.  *        Networks and Distributed Computing
  6.  *        Computing & Communications
  7.  *        University of Washington
  8.  *        Administration Building, AG-44
  9.  *        Seattle, WA  98195
  10.  *        Internet: MRC@CAC.Washington.EDU
  11.  *
  12.  * Date:    15 June 1988
  13.  * Last Edited:    6 September 1995
  14.  *
  15.  * Sponsorship:    The original version of this work was developed in the
  16.  *        Symbolic Systems Resources Group of the Knowledge Systems
  17.  *        Laboratory at Stanford University in 1987-88, and was funded
  18.  *        by the Biomedical Research Technology Program of the National
  19.  *        Institutes of Health under grant number RR-00785.
  20.  *
  21.  * Original version Copyright 1988 by The Leland Stanford Junior University
  22.  * Copyright 1995 by the University of Washington
  23.  *
  24.  *  Permission to use, copy, modify, and distribute this software and its
  25.  * documentation for any purpose and without fee is hereby granted, provided
  26.  * that the above copyright notices appear in all copies and that both the
  27.  * above copyright notices and this permission notice appear in supporting
  28.  * documentation, and that the name of the University of Washington or The
  29.  * Leland Stanford Junior University not be used in advertising or publicity
  30.  * pertaining to distribution of the software without specific, written prior
  31.  * permission.  This software is made available "as is", and
  32.  * THE UNIVERSITY OF WASHINGTON AND THE LELAND STANFORD JUNIOR UNIVERSITY
  33.  * DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO THIS SOFTWARE,
  34.  * INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  35.  * FITNESS FOR A PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
  36.  * WASHINGTON OR THE LELAND STANFORD JUNIOR UNIVERSITY BE LIABLE FOR ANY
  37.  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  38.  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
  39.  * CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF
  40.  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  41.  *
  42.  */
  43.  
  44. /* IMAP2 specific definitions */
  45.  
  46. /* Parameters */
  47.  
  48. #define MAXLOGINTRIALS 3    /* maximum number of login trials */
  49. #define MAPLOOKAHEAD 20        /* fetch lookahead */
  50. #define IMAPTCPPORT (long) 143    /* assigned TCP contact port */
  51.  
  52.  
  53. /* Parsed reply message from imap_reply */
  54.  
  55. typedef struct imap_parsed_reply {
  56.   char *line;            /* original reply string pointer */
  57.   char *tag;            /* command tag this reply is for */
  58.   char *key;            /* reply keyword */
  59.   char *text;            /* subsequent text */
  60. } IMAPPARSEDREPLY;
  61.  
  62.  
  63. #define IMAPTMPLEN 16*MAILTMPLEN
  64.  
  65. /* IMAP2 I/O stream local data */
  66.  
  67. typedef struct imap_local {
  68.   void *tcpstream;        /* TCP I/O stream */
  69.   IMAPPARSEDREPLY reply;    /* last parsed reply */
  70.   unsigned int use_body : 1;    /* server supports structured bodies */
  71.   unsigned int use_find : 1;    /* server supports FIND command */
  72.   unsigned int use_bboard : 1;    /* server supports BBOARD command */
  73.   unsigned int use_purge : 1;    /* server supports PURGE command */
  74.   char *user;            /* logged in user name */
  75.   char *prefix;            /* find prefix */
  76.   char tmp[IMAPTMPLEN];        /* temporary buffer */
  77. } IMAPLOCAL;
  78.  
  79.  
  80. /* Convenient access to local data */
  81.  
  82. #define LOCAL ((IMAPLOCAL *) stream->local)
  83.  
  84. /* Coddle certain compilers' 6-character symbol limitation */
  85.  
  86. #ifdef __COMPILER_KCC__
  87. #define map_valid ivalid
  88. #define map_parameters iparam
  89. #define map_find ifind
  90. #define map_find_bboards ifindb
  91. #define map_find_all ifnda
  92. #define map_find_all_bboards ifndab
  93. #define map_subscribe isubsc
  94. #define map_unsubscribe iunsub
  95. #define map_subscribe_bboard isubbb
  96. #define map_unsubscribe_bboard iusbbb
  97. #define map_create icreat
  98. #define map_delete idelet
  99. #define map_rename irenam
  100. #define map_manage imanag
  101. #define map_open iopen
  102. #define map_close iclose
  103. #define map_fetchfast iffast
  104. #define map_fetchflags ifflags
  105. #define map_fetchstructure ifenv
  106. #define map_fetchheader ifhead
  107. #define map_fetchtext iftext
  108. #define map_fetchbody ifbody
  109. #define map_setflag isflag
  110. #define map_clearflag icflag
  111. #define map_search isearch
  112. #define map_ping iping
  113. #define map_check icheck
  114. #define map_expunge iexpun
  115. #define map_copy icopy
  116. #define map_move imove
  117. #define map_append iappnd
  118. #define map_gc igc
  119. #define map_gc_body igcb
  120.  
  121. #define imap_host imhost
  122. #define imap_port import
  123. #define imap_user imuser
  124. #define imap_select imsele
  125. #define imap_send imsend
  126. #define imap_soutr imsotr
  127. #define imap_reply imrepl
  128. #define imap_parse_reply imprep
  129. #define imap_fake imfake
  130. #define imap_OK imok
  131. #define imap_parse_unsolicited impuns
  132. #define imap_parse_flaglst impflg
  133. #define imap_searched imsear
  134. #define imap_expunged imexpu
  135. #define imap_parse_data impdat
  136. #define imap_parse_prop imppro
  137. #define imap_parse_envelope impenv
  138. #define imap_parse_adrlist impadl
  139. #define imap_parse_address impadr
  140. #define imap_parse_flags impfla
  141. #define imap_parse_sys_flag impsfl
  142. #define imap_parse_user_flag impufl
  143. #define imap_parse_string impstr
  144. #define imap_parse_number impnum
  145. #define imap_parse_enclist impecl
  146. #define imap_parse_encoding impenc
  147. #define imap_parse_body impbod
  148. #define imap_parse_body_structure impbst
  149. #endif
  150.  
  151. /* imap_send() helper macros */
  152.  
  153. #define imap_send0(s,c) imap_send (s,c,NIL,NIL,NIL,NIL,NIL,NIL)
  154. #define imap_send1(s,c,a1) imap_send (s,c,NIL,a1,NIL,NIL,NIL,NIL)
  155. #define imap_send2(s,c,a1,a2) imap_send (s,c,NIL,a1,a2,NIL,NIL,NIL)
  156. #define imap_send2f(s,c,a1,a2,a3) imap_send (s,c,NIL,a1,a2,a3,NIL,NIL)
  157. #define imap_sendq1(s,c,a1) imap_send (s,c,a1,NIL,NIL,NIL,NIL,NIL)
  158. #define imap_sendq2(s,c,a1,a2) imap_send (s,c,a1,NIL,NIL,NIL,a2,NIL)
  159.  
  160. /* Function prototypes */
  161.  
  162. DRIVER *map_valid  ();
  163. void *map_parameters  ();
  164. void map_find  ();
  165. void map_find_bboards  ();
  166. void map_find_all  ();
  167. void map_find_all_bboards  ();
  168. long map_subscribe  ();
  169. long map_unsubscribe  ();
  170. long map_subscribe_bboard  ();
  171. long map_unsubscribe_bboard  ();
  172. long map_create  ();
  173. long map_delete  ();
  174. long map_rename  ();
  175. long map_manage  ();
  176. MAILSTREAM *map_open  ();
  177. void map_close  ();
  178. void map_fetchfast  ();
  179. void map_fetchflags  ();
  180. ENVELOPE *map_fetchstructure  ();
  181. char *map_fetchheader  ();
  182. char *map_fetchtext  ();
  183. char *map_fetchbody  ();
  184. void map_setflag  ();
  185. void map_clearflag  ();
  186. void map_search  ();
  187. long map_ping  ();
  188. void map_check  ();
  189. void map_expunge  ();
  190. long map_copy  ();
  191. long map_move  ();
  192. long map_append  ();
  193. void map_gc  ();
  194. void map_gc_body  ();
  195.  
  196. char *imap_host  ();
  197. long imap_port  ();
  198. char *imap_user  ();
  199. IMAPPARSEDREPLY *imap_send  ();
  200. IMAPPARSEDREPLY *imap_soutr  ();
  201. IMAPPARSEDREPLY *imap_reply  ();
  202. IMAPPARSEDREPLY *imap_parse_reply  ();
  203. IMAPPARSEDREPLY *imap_fake  ();
  204. long imap_OK  ();
  205. void imap_parse_unsolicited  ();
  206. void imap_parse_flaglst  ();
  207. void imap_searched  ();
  208. void imap_expunged  ();
  209. void imap_parse_data  ();
  210. void imap_parse_prop  ();
  211. void imap_parse_envelope  ();
  212. ADDRESS *imap_parse_adrlist  ();
  213. ADDRESS *imap_parse_address  ();
  214. void imap_parse_flags  ();
  215. void imap_parse_user_flag  ();
  216. char *imap_parse_string  ();
  217. unsigned long imap_parse_number  ();
  218. void imap_parse_body  ();
  219. void imap_parse_body_structure  ();
  220.